<template>
  <!-- 线下活动主体部分 -->
  <main class="activities-main">
    <ul>
      <li v-for="value of activitiesList.result" :key="value._id">
        <img :src="value.img" alt="" />
        <div class="right">
          <p class="title">
            <span v-if="value.free" class="free">{{ value.free }}</span>
            {{ value.title }}
          </p>
          <!-- 评分 -->
          <p class="score" v-if="value.point !== '0'">
            <span>{{ value.point }}分</span>
            <img src="@/assets/images/线下活动/xxhd-24@2x.png" alt="" />
          </p>
          <!-- 时间地址 -->
          <p class="time-site">
            <span>{{ value.time }}</span>
            <img src="@/assets/images/线下活动/xxhd-2@2x.png" alt="" />
            <span>{{ value.address }}</span>
          </p>
          <!-- 价格 -->
          <p class="price">{{ value.money }}</p>
        </div>
      </li>
    </ul>
    <div class="ok">已经全部加载完毕</div>
  </main>
</template>

<script>
import { useStore } from "vuex";
import { computed, onMounted } from "vue";
export default {
  setup() {
    const store = useStore();
    const getactivities = () => store.dispatch("getactivities");
    const activitiesList = computed(
      () => store.state.activities.getactivitiesContent
    );
    onMounted(() => {
      getactivities();
    });
    return {
      getactivities,
      activitiesList,
    };
  },
};
</script>

<style lang="less" scoped>
.activities-main {
  padding: 0 14px;
  ul {
    li {
      display: flex;
      margin-bottom: 28px;
      justify-content: space-between;
      align-items: center;
      img {
        width: 152px;
        height: 114.5px;
        margin-right: 14px;
      }
      .right {
        flex: 1;
        height: 114.5px;
        padding: 3px 0 5px 0;
        position: relative;
        .title {
          font-size: 15px;
          margin-bottom: 12.5px;
          .free {
            display: inline-block;
            width: 38px;
            height: 18px;
            font-size: 10px;
            color: white;
            background-color: #45c7a3;
            border-radius: 4px;
            line-height: 18px;
          }
        }
        .score {
          margin-bottom: 10px;
          display: flex;
          align-items: center;
          span {
            display: flex;
            align-items: center;
            font-size: 12px;
            color: #ffd300;
            margin-right: 7px;
          }
          img {
            width: 91px;
            height: 13.5px;
          }
        }
        // 时间地址
        .time-site {
          display: flex;
          align-items: center;
          span {
            &:first-of-type {
              color: #666666;
              font-size: 12px;
              margin-right: 7px;
            }
            &:last-of-type {
              color: #666666;
              font-size: 13px;
            }
          }
          img {
            width: 11px;
            height: 10px;
            margin-right: 7px;
          }
        }
        // 价格
        .price {
          font-size: 16px;
          color: #eb4c50;
          position: absolute;
          left: 0;
          bottom: 0;
        }
      }
    }
  }
  .ok {
    font-size: 14px;
    text-align: center;
    margin-bottom: 66.5px;
  }
}
</style>
